<template>
  <div>
    <van-nav-bar
      fixed
      placeholder
      safe-area-inset-top
      title="毕业季喜报"
      @click-left="back"
    >
      <template #left>
        <van-icon name="arrow-left" size="16px" color="#333" />
      </template>
    </van-nav-bar>
    <img :src="url" alt="" width="100%" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      url: "",
    };
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    getImage() {
      fetch(`https://api.nuanuan.net/index/banner?type=${4}`, {
        method: "GET",
      })
        .then((res) => res.json())
        .then((res) => {
          console.log("毕业季喜报", res);
          this.url = res.data[0].url;
        });
    },
  },
  created() {
    this.getImage();
  },
};
</script>

<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
}
img {
  display: block;
}
</style>